package org.example.product.controller.front;

import org.example.core.utils.R;
import org.example.product.service.ProductService;
import org.example.product.vo.SkuItemVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.ExecutionException;

/**
 * @author 小杰_cc
 * @version 1.0
 */
@RestController
@RequestMapping("/pms/front/info")
public class ProductFrontController {

    @Autowired
    private ProductService productService;

    // 前台商品信息
    @GetMapping("/{skuId}")
    public R<?> productInfo(@PathVariable("skuId") Long skuId) throws ExecutionException, InterruptedException {
        SkuItemVo skuItemVo = productService.productInfo(skuId);
        return R.ok(skuItemVo);
    }

}
